package cn.bdqn.repository;

import cn.bdqn.pojo.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import javax.transaction.Transactional;

//用户模块部分
public interface Asecu_UserRepository extends JpaRepository<User,Integer>, JpaSpecificationExecutor<User> {
    //登入验证
    public User findByname(@Param("name") String name);

    @Transactional
    @Modifying
    @Query("update from User set password = :password where id=:id")
    public int updatPwd(@Param("password") String password,@Param("id") Integer id);

    @Transactional
    @Modifying
    @Query("update from User set state = :state where id=:id")
    public int updatstate(@Param("id") Integer id,@Param("state") String state);


   @Transactional
    @Modifying
    @Query("update from User set name= :name,xname= :xname,jobs= :jobs,qualification= :qualification  where id=:id")
    public int updatportion(@Param("id") Integer id,@Param("name") String name,@Param("xname") String xname,@Param("jobs") String jobs,@Param("qualification") String qualification);


    @Transactional
    @Modifying
    @Query("update from User set roleId = :roleId where id=:id")
    public int updatroel(@Param("id") Integer id,@Param("roleId") Integer roleId);


}
